package org.lee.util;

import java.util.List;

/**
 * @author jackielee
 * @version 1.0
 * @description ListUtil
 * @date 2021/5/21
 */
public class ListUtil {

  public static <T> boolean addIfNotExists(List<T> list, T item) {
    if (item == null) {
      return false;
    }
    if (list.contains(item)) {
      return false;
    }
    if (item.getClass() == String.class && StringUtil.isEmpty(item.toString())) {
      return false;
    }
    return list.add(item);
  }
}
